package com.zhixin.fans.ks.ui.main;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import org.eenie.common.base.BaseFragment;

import java.util.ArrayList;
import java.util.List;

import android.support.annotation.Nullable;


public class MainPageFragmentAdapter extends FragmentPagerAdapter {

    List<BaseFragment> mFragments = new ArrayList<>();


    public MainPageFragmentAdapter(FragmentManager fm, List<BaseFragment> fragments) {
        super(fm);
        mFragments.addAll(fragments);
    }

    @Override
    public Fragment getItem(int position) {
        return mFragments.get(position);
    }

    @Override
    public int getCount() {
        return mFragments.size();
    }


    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return mFragments.get(position).getTitle();
    }
}
